﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASBCC.Database.Service;
using BEGDC.CC.Web.Common;
using Telerik.Web.UI;

namespace BEGDC.CC.Web.Workflow.Dialog
{
    public partial class Log : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ucPager.Query();
            }
        }

        protected void rgLog_OnSortCommand(object source, Telerik.Web.UI.GridSortCommandEventArgs e)
        {
            ucPager.Sort(e);
        }

        protected void ucPager_OnNeedDataSource(object sender, PagerEventArgs e)
        {
            object count = 0;
            ucPager.DataSource = DatabaseManager.usp3_SELECT_ProcessLog(e.IsLast, "", ucPager.PageIndex, ucPager.PageSize, ProcInstID, ref count);
            ucPager.RowsCount = (int)count;
        }

        public int ProcInstID
        {
            get
            {
                int procInstId;
                bool res = int.TryParse(Request.QueryString["ProcInstID"], out procInstId);
                if (res) return procInstId;
                return -1;
            }
        }
    }
}